package br.com.ordemservico.control.conexao;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;

public class Conexao {
	private EntityManager eM;
	private EntityManagerFactory factory;
	private EntityTransaction eT;
	
	public Conexao(){
		factory = Persistence.createEntityManagerFactory("EVENTO_PU");
	}
	public void conectar(){
		factory = Persistence.createEntityManagerFactory("EVENTO_PU");
		eM = factory.createEntityManager();
		eT = eM.getTransaction();
	}
	public EntityManager getEntityManager(){
		return eM;
	}
	public EntityTransaction getTransaction(){
		return eT;
	}
}
